package com.market.controller.wx;

import com.market.bean.MarketTopic;
import com.market.bean.common.BasePageInfo;
import com.market.bean.common.BaseRespVo;
import com.market.bean.common.CommonData;
import com.market.service.wx.WxTopicService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.yaml.snakeyaml.events.Event;

/**
 * 小程序专题
 * @author wh194@foxmail.com
 * @since 2023/01/01 17:34
 */
@RestController
@RequestMapping("wx/topic")
public class WxTopicController {

    @Autowired
    WxTopicService topicService;

    @GetMapping("list")
    public BaseRespVo list(BasePageInfo info, String title, String subtitle) {
        CommonData<MarketTopic> data = topicService.list(info, title, subtitle);
        return BaseRespVo.ok(data);
    }

    @GetMapping("detail")
    public BaseRespVo detail(Integer id){
        MarketTopic data = topicService.detail(id);
        return BaseRespVo.ok(data);
    }

    @GetMapping("related")
    public BaseRespVo related(Integer id){
        MarketTopic data = topicService.related(id);
        return BaseRespVo.ok(data);
    }
}
